package com.ruoyi.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 * 
 * @author lynn
 */
@Component
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig
{
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

    /** 版权年份 */
    private String copyrightYear;

    /** 实例演示开关 */
    private boolean demoEnabled;

    /** 上传路径 */
    private static String profile;

    /** 获取地址开关 */
    private static boolean addressEnabled;

    /** 验证码类型 */
    private static String captchaType;

    /** mysql 安装路径 */
    private static String mysqlPath;

    /** mysql 访问地址 */
    private static String mysqlUrl;

    /** mysql 端口号 */
    private static String mysqlPort;

    /** mysql 用户名 */
    private static String mysqlUsername;

    /** mysql 密码 */
    private static String mysqlPassword;

    /** 数据库名 */
    private static String DBName;

    /** 备份文件存放地址 */
    private static String backupUrl;

    /** 门禁Api地址 */
    private static String apiUrl;
    /** 门禁Token */
    private static String accessToken;

    /** 一拖二Token */
    private static String accessKey;

    /** 一拖二账号 */
    private static String socketTwoUsername;
    /** 一拖二密码 */
    private static String socketTwoPassword;


    /** 回调地址 */
    private static String notifyUrl;

    public static String getSocketTwoPassword() {
        return socketTwoPassword;
    }

    public void setSocketTwoPassword(String socketTwoPassword) {
        RuoYiConfig.socketTwoPassword = socketTwoPassword;
    }

    public static String getSocketTwoUsername() {
        return socketTwoUsername;
    }

    public void setSocketTwoUsername(String socketTwoUsername) {
        RuoYiConfig.socketTwoUsername = socketTwoUsername;
    }


    public static String getApiUrl() {
        return apiUrl;
    }

    public void setApiUrl(String apiUrl) {
        RuoYiConfig.apiUrl = apiUrl;
    }

    public static String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        RuoYiConfig.accessKey = accessKey;
    }

    public static String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        RuoYiConfig.notifyUrl = notifyUrl;
    }

    public static String getAccessToken()
    {
        return accessToken;
    }

    public void setAccessToken(String accessToken)
    {
        this.accessToken = accessToken;
    }

    public static String getMysqlPath()
    {
        return mysqlPath;
    }

    public void setMysqlPath(String mysqlPath)
    {
        this.mysqlPath = mysqlPath;
    }

    public static String getMysqlUrl()
    {
        return mysqlUrl;
    }

    public void setMysqlUrl(String mysqlUrl)
    {
        this.mysqlUrl = mysqlUrl;
    }

    public static String getMysqlPort()
    {
        return mysqlPort;
    }

    public void setMysqlPort(String mysqlPort)
    {
        this.mysqlPort = mysqlPort;
    }

    public static String getMysqlUsername()
    {
        return mysqlUsername;
    }

    public void setMysqlUsername(String mysqlUsername)
    {
        this.mysqlUsername = mysqlUsername;
    }

    public static String getMysqlPassword()
    {
        return mysqlPassword;
    }

    public void setMysqlPassword(String mysqlPassword)
    {
        this.mysqlPassword = mysqlPassword;
    }

    public static String getDBName()
    {
        return DBName;
    }

    public void setDBName(String DBName)
    {
        this.DBName = DBName;
    }

    public static String getBackupUrl()
    {
        return backupUrl;
    }

    public void setBackupUrl(String backupUrl)
    {
        this.backupUrl = backupUrl;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getVersion()
    {
        return version;
    }

    public void setVersion(String version)
    {
        this.version = version;
    }

    public String getCopyrightYear()
    {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear)
    {
        this.copyrightYear = copyrightYear;
    }

    public boolean isDemoEnabled()
    {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled)
    {
        this.demoEnabled = demoEnabled;
    }

    public static String getProfile()
    {
        return profile;
    }

    public void setProfile(String profile)
    {
        RuoYiConfig.profile = profile;
    }

    public static boolean isAddressEnabled()
    {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled)
    {
        RuoYiConfig.addressEnabled = addressEnabled;
    }

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        RuoYiConfig.captchaType = captchaType;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }

    /**
     * 获取sql文件保存路径
     */
    public static String getSqlFilePath()
    {
        return getProfile() + "/backup";
    }

    /**
     * 获取临时文件保存路径
     */
    public static String getTempFilePath()
    {
        return getProfile() + "/temp";
    }
}
